﻿bride_show_decision = {
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_female = no
					government_has_flag = government_is_nomadic
				}
				desc = nomad_bride_show_decision_m
			}
			triggered_desc = {
				trigger = {
					is_female = no
					government_has_flag = government_is_tribal
				}
				desc = tribal_bride_show_decision_m
			}
			triggered_desc = {
				trigger = {
					is_female = no
				}
				desc = bride_show_decision_m
			}
			triggered_desc = {
				trigger = {
					is_female = yes
					government_has_flag = government_is_nomadic
				}
				desc = nomad_bride_show_decision_f
			}
			triggered_desc = {
				trigger = {
					is_female = yes
					government_has_flag = government_is_tribal
				}
				desc = tribal_bride_show_decision_f
			}
			desc = bride_show_decision_f
		}
	}
	picture = {
		trigger = {
			government_has_flag = government_is_nomadic
		}
		reference = "gfx/interface/illustrations/activity_splash_screens/tour_arrival_tribal_neutral.dds"
	}
	picture = {
		trigger = {
			NOT = {
				government_has_flag = government_is_nomadic
			}
		}
		reference = "gfx/interface/illustrations/decisions/decision_recruitment.dds"
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_female = no
					government_has_flag = government_is_nomadic
				}
				desc = bride_show_decision_desc_m_nomadic
			}
			triggered_desc = {
				trigger = {
					is_female = no
					government_has_flag = government_is_tribal
				}
				desc = bride_show_decision_desc_m_tribal
			}
			triggered_desc = {
				trigger = {
					is_female = no
				}
				desc = bride_show_decision_desc_m
			}
			triggered_desc = {
				trigger = {
					is_female = yes
					government_has_flag = government_is_nomadic
				}
				desc = bride_show_decision_desc_f_nomadic
			}
			triggered_desc = {
				trigger = {
					is_female = yes
					government_has_flag = government_is_tribal
				}
				desc = bride_show_decision_desc_f_tribal
			}
			desc = bride_show_decision_desc_f
		}
	}
	selection_tooltip = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					is_female = yes
			    }
			    desc = bride_show_selection_decision_tooltip_f
			}
			desc = bride_show_selection_decision_tooltip_m
		}
	}

	decision_group_type = courtier
	ai_check_interval = 36
	sort_order = 120

	confirm_text = bride_show_decision_confirm
	
	is_shown = {
		is_landed = yes
		OR = {
			culture = { has_cultural_tradition = tradition_ep3_palace_politics }
			culture = { has_cultural_tradition = tradition_legalistic }
			hp_accepts_concubinage = yes
			hp_accepts_polygamy = yes
		}
		highest_held_title_tier >= tier_duchy
		OR = { #Appropriate dominant sex
			AND = {
				is_male = no
				OR = {
					has_realm_law = female_only_law
					has_realm_law = female_preference_law
				}
			}
			AND = {
				is_male = yes
				OR = {
					has_realm_law = male_only_law
					has_realm_law = male_preference_law
				}
			}
			has_realm_law = equal_law
		}
		NOT = {
			religion = religion:islam_religion
		}
	}

	is_valid = {
		age >= 15
		is_at_war = no

		#Combinations: 3 non-republican, non-theocratic and non-herding subject who are not at war with their overlord.
		#Either 3 vassals, 4 tributaries, or 2 vassals and 2 tributaries
		trigger_if = { #Nomadic rulers
			limit = {
				government_has_flag = government_is_nomadic
			}
			custom_tooltip = {
				text = bride_show_nomadic_ruler_subject_tooltip
				OR = {
					any_vassal = { #4 vassals
						harem_politics_minimum_valid_subject_requirements_trigger = {
							OVERLORD = root
						}
						count >= 4
					}
					any_tributary = { #4 tributaries
						harem_politics_minimum_valid_subject_requirements_trigger = {
							OVERLORD = root
						}
						count >= 4
					}
					AND = { #2 vassals and 2 tributaries
						any_vassal = {
							harem_politics_minimum_valid_subject_requirements_trigger = {
								OVERLORD = root
							}
							count >= 2
						}
						any_tributary = {
							harem_politics_minimum_valid_subject_requirements_trigger = {
								OVERLORD = root
							}
							count >= 2
						}
					}
					AND = { #3 vassals and 1 tributary
						any_vassal = {
							harem_politics_minimum_valid_subject_requirements_trigger = {
								OVERLORD = root
							}
							count >= 3
						}
						any_tributary = {
							harem_politics_minimum_valid_subject_requirements_trigger = {
								OVERLORD = root
							}
							count >= 1
						}
					}
					AND = { #1 vassal and 3 tributaries
						any_vassal = {
							harem_politics_minimum_valid_subject_requirements_trigger = {
								OVERLORD = root
							}
							count >= 1
						}
						any_tributary = {
							harem_politics_minimum_valid_subject_requirements_trigger = {
								OVERLORD = root
							}
							count >= 3
						}
					}
				}
			}
		}
		trigger_else_if = { #Dukes
			limit = {
				highest_held_title_tier = tier_duchy
			}
			trigger_if = { #Only sovereigns can host a bride show
				limit = {
					government_allows = administrative
				}
				is_governor = no
				is_independent_ruler = yes
			}
			trigger_else_if = { # Feudal/Clan/Tribal Duke
				limit = {
					NOR = {
						government_allows = administrative
						government_has_flag = government_is_nomadic
					}
				}
				trigger_if = { #Low Authority
					limit = {
						OR = {
							has_realm_law = crown_authority_0
							has_realm_law = tribal_authority_0
						}
					}
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_vassal_tooltip
							any_vassal = {
								is_powerful_vassal = no
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_vassal_tooltip
								any_vassal = {
									is_powerful_vassal = no
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else = { #Limited Authority+
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_1_duke_vassal_tooltip
							any_vassal = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_1_duke_subject_vassal_tooltip
								any_vassal = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
			}
			trigger_else = {
				always = no
			}
		}
		trigger_else_if = { #Kings
			limit = {
				highest_held_title_tier = tier_kingdom
			}
			trigger_if = { #Only sovereigns can host a bride show
				limit = {
					government_allows = administrative
				}
				is_independent_ruler = yes
				trigger_if = { #Low Imperial Bureaucracy
					limit = {
						has_realm_law = imperial_bureaucracy_0
					}
					OR = { #3 non-powerful vassals
						custom_tooltip = {
							text = bride_show_imperial_authority_0_king_vassal_tooltip
							any_vassal = {
								trigger_if = {
									limit = {
										government_allows = administrative
									}
									house ?= { 
										is_dominant_family = no 
										is_powerful_family = no
									}
								}
								trigger_else = {
									is_powerful_vassal = no
									highest_held_title_tier <= tier_county
								}
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = { #4 tributaries
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = { #2 vassals and 2 tributaries
							custom_tooltip = {
								text = bride_show_imperial_authority_0_king_subject_vassal_tooltip
								any_vassal = {
									trigger_if = {
										limit = {
											government_allows = administrative
										}
										house ?= { 
											is_dominant_family = no 
											is_powerful_family = no
										}
									}
									trigger_else = {
										is_powerful_vassal = no
										highest_held_title_tier <= tier_county
									}
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else_if = { #Limited Imperial Bureaucracy
					limit = {
						has_realm_law = imperial_bureaucracy_1
					}
					OR = { #3 non-influential vassals
						custom_tooltip = {
							text = bride_show_imperial_authority_1_king_vassal_tooltip
							any_vassal = {
								trigger_if = {
									limit = {
										government_allows = administrative
									}
									house ?= { 
										is_dominant_family = no 
									}
								}
								trigger_else = {
									is_powerful_vassal = no
								}
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = { #4 tributaries
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = { #2 vassals and 2 tributaries
							custom_tooltip = {
								text = bride_show_imperial_authority_1_king_subject_vassal_tooltip
								any_vassal = {
									trigger_if = {
										limit = {
											government_allows = administrative
										}
										house ?= { 
											is_dominant_family = no 
										}
									}
									trigger_else = {
										is_powerful_vassal = no
									}
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else = { #High Imperial Bureaucracy+
					OR = { #3 vassals
						custom_tooltip = {
							text = bride_show_feudal_authority_1_duke_vassal_tooltip
							any_vassal = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = { #4 tributaries
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = { #2 vassals and 2 tributaries
							custom_tooltip = {
								text = bride_show_feudal_authority_1_duke_subject_vassal_tooltip
								any_vassal = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
			}
			trigger_else_if = { # Feudal/Clan/Tribal King
				limit = {
					NOR = {
						government_allows = administrative
						government_has_flag = government_is_nomadic
					}
				}
				trigger_if = { #Low Authority
					limit = {
						OR = {
							has_realm_law = crown_authority_0
							has_realm_law = tribal_authority_0
						}
					}
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_0_king_vassal_tooltip
							any_vassal = {
								is_powerful_vassal = no
								highest_held_title_tier <= tier_county
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_0_king_subject_vassal_tooltip
								any_vassal = {
									is_powerful_vassal = no
									highest_held_title_tier <= tier_county
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else_if = { #Limited Authority
					limit = {
						OR = {
							has_realm_law = crown_authority_1
							has_realm_law = tribal_authority_1
						}
					}
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_vassal_tooltip
							any_vassal = {
								is_powerful_vassal = no
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_vassal_tooltip
								any_vassal = {
									is_powerful_vassal = no
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else = { #High Authority+
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_1_duke_vassal_tooltip
							any_vassal = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_1_duke_subject_vassal_tooltip
								any_vassal = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
			}
			trigger_else = {
				always = no
			}
		}
		trigger_else_if = { #Emperors
			limit = {
				highest_held_title_tier = tier_empire
			}
			trigger_if = { #Administrative Emperor
				limit = {
					government_allows = administrative
				}
				trigger_if = { #Low Imperial Bureaucracy
					limit = {
						has_realm_law = imperial_bureaucracy_0
					}
					OR = { #3 non-powerful vassals
						custom_tooltip = {
							text = bride_show_imperial_authority_0_king_vassal_tooltip
							any_vassal = {
								trigger_if = {
									limit = {
										government_allows = administrative
									}
									house ?= { 
										is_dominant_family = no 
										is_powerful_family = no
									}
								}
								trigger_else = {
									is_powerful_vassal = no
									highest_held_title_tier <= tier_duchy
								}
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = { #4 tributaries
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = { #2 vassals and 2 tributaries
							custom_tooltip = {
								text = bride_show_imperial_authority_0_king_subject_vassal_tooltip
								any_vassal = {
									trigger_if = {
										limit = {
											government_allows = administrative
										}
										house ?= { 
											is_dominant_family = no 
											is_powerful_family = no
										}
									}
									trigger_else = {
										is_powerful_vassal = no
										highest_held_title_tier <= tier_duchy
									}
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else_if = { #Limited Imperial Bureaucracy
					limit = {
						has_realm_law = imperial_bureaucracy_1
					}
					OR = { #3 non-influential vassals
						custom_tooltip = {
							text = bride_show_imperial_authority_1_king_vassal_tooltip
							any_vassal = {
								trigger_if = {
									limit = {
										government_allows = administrative
									}
									house ?= { 
										is_dominant_family = no
									}
								}
								trigger_else = {
									is_powerful_vassal = no
								}
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = { #4 tributaries
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = { #2 vassals and 2 tributaries
							custom_tooltip = {
								text = bride_show_imperial_authority_1_king_subject_vassal_tooltip
								any_vassal = {
									trigger_if = {
										limit = {
											government_allows = administrative
										}
										house ?= { 
											is_dominant_family = no 
										}
									}
									trigger_else = {
										is_powerful_vassal = no
									}
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else = { #High Imperial Bureaucracy+
					OR = { #3 vassals
						custom_tooltip = {
							text = bride_show_feudal_authority_1_duke_vassal_tooltip
							any_vassal = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = { #4 tributaries
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = { #2 vassals and 2 tributaries
							custom_tooltip = {
								text = bride_show_feudal_authority_1_duke_subject_vassal_tooltip
								any_vassal = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
			}
			trigger_else_if = { # Feudal/Clan/Tribal Emperor
				limit = {
					NOR = {
						government_allows = administrative
						government_has_flag = government_is_nomadic
					}
				}
				trigger_if = { #Low Authority
					limit = {
						OR = {
							has_realm_law = crown_authority_0
							has_realm_law = tribal_authority_0
						}
					}
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_0_emperor_vassal_tooltip
							any_vassal = {
								is_powerful_vassal = no
								highest_held_title_tier <= tier_duchy
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_0_emperor_subject_vassal_tooltip
								any_vassal = {
									is_powerful_vassal = no
									highest_held_title_tier <= tier_duchy
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else_if = { #Limited Authority
					limit = {
						OR = {
							has_realm_law = crown_authority_1
							has_realm_law = tribal_authority_1
						}
					}
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_vassal_tooltip
							any_vassal = {
								is_powerful_vassal = no
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_vassal_tooltip
								any_vassal = {
									is_powerful_vassal = no
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
				trigger_else = { #High Authority+
					OR = {
						custom_tooltip = {
							text = bride_show_feudal_authority_1_duke_vassal_tooltip
							any_vassal = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 3
							}
						}
						custom_tooltip = {
							text = bride_show_feudal_authority_0_duke_tributary_tooltip
							any_tributary = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								count >= 4
							}
						}
						AND = {
							custom_tooltip = {
								text = bride_show_feudal_authority_1_duke_subject_vassal_tooltip
								any_vassal = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
							custom_tooltip = {
								text = bride_show_feudal_authority_0_duke_subject_tributary_tooltip
								any_tributary = {
									harem_politics_minimum_valid_subject_requirements_trigger = {
										OVERLORD = root
									}
									count >= 2
								}
							}
						}
					}
				}
			}
			trigger_else = {
				always = no
			}
		}
		trigger_else = {
			always = no
		}
	}
	
	is_valid_showing_failures_only = {
		is_available = yes
		NOT = {
			has_trait = devoted
		}
		custom_tooltip = {
			text = not_enough_gold_bride_show
			gold >= minor_gold_value
		}
		custom_tooltip = {
			text = mourning_bride_show
			NOT = { has_character_modifier = mourner_modifier }
		}

		custom_tooltip = {
			text = contagious_disease_bride_show
			has_epidemic_disease_trigger = no
		}
		custom_tooltip = {
			text = epidemic_bride_show
			NOR = {
				realm_has_any_epidemic = {
					SIZE = 1
					INTENSITY = minor
				}
				capital_county = { has_county_modifier = isolate_capital_decision_modifier }
			}
		}
		custom_tooltip = {
			text = seclusion_bride_show
			NOR = {
				has_character_modifier = isolating_modifier
			}
		}
	}
	
	
	cooldown = { years = 4 }
	
	cost = {
		prestige = {
			value = 0
			if = {
				limit = { NOT = { government_has_flag = government_has_influence } }
				add = {
					add = minor_prestige_value
					if = {
						limit = {
							highest_held_title_tier > tier_duchy
						}
						add = minor_prestige_value
					}
				}
			}
			# Add extra prestige cost if nomadic
			if = {
				limit = {
					government_has_flag = government_is_nomadic
				}
				add = medium_prestige_value
			}
			# Add extra prestige cost if not enough vassals
			if = {
				limit = {
					trigger_if = {
						limit = { government_has_flag = government_is_nomadic }
						NOT = {
							any_vassal = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								any_courtier = {
									bride_show_viable_candidate_trigger = {
										OVERLORD = root
									} 
								}
								count >= 4
							}
						}
					}
					trigger_else = {
						NOT = {
							any_vassal = {
								harem_politics_minimum_valid_subject_requirements_trigger = {
									OVERLORD = root
								}
								any_courtier = {
									bride_show_viable_candidate_trigger = {
										OVERLORD = root
									} 
								}
								count >= 3
							}
						}
					}
				}
				add = minor_prestige_value
			}
		}
		influence = {
			value = 0
			if = {
				limit = { government_has_flag = government_has_influence }
				add = {
					add = minor_influence_value
					if = {
						limit = {
							highest_held_title_tier > tier_duchy
						}
						add = minor_influence_value
					}
				}
			}
		}
	}

	effect = {
		custom_tooltip = bride_show_effect_tooltip
		custom_tooltip = bride_show_opinion_effect_tooltip
		hidden_effect = {
			save_scope_as = liege
			# First check vassals
			if = {
				limit = {
					any_vassal = {
						harem_politics_is_valid_bride_show_subject_trigger = {
							OVERLORD = scope:liege
						}
						any_courtier = {
							bride_show_viable_candidate_trigger = {
								OVERLORD = scope:liege
							} 
						}
						count >= 1
					}
				}
				every_vassal = {
					limit = {
						harem_politics_is_valid_bride_show_subject_trigger = {
							OVERLORD = scope:liege
						}
						any_courtier = {
							bride_show_viable_candidate_trigger = {
								OVERLORD = scope:liege
							} 
						}
					}
					add_to_list = bride_show_preliminary_list
				}
			}
			# Check tributaries with additional acceptance criteria
			if = {
				limit = {
					any_tributary = {
						harem_politics_minimum_valid_subject_requirements_trigger = {
							OVERLORD = scope:liege
						}
						any_courtier = {
							bride_show_viable_candidate_trigger = {
								OVERLORD = scope:liege
							} 
						}
					}
				}
				every_tributary = {
					limit = {
						harem_politics_minimum_valid_subject_requirements_trigger = {
							OVERLORD = scope:liege
						}
						any_courtier = {
							bride_show_viable_candidate_trigger = {
								OVERLORD = scope:liege
							} 
						}
					}
					add_to_list = bride_show_preliminary_list
				}
			}
			#Check that we have enough candidates
			if = { #Nomadic rulers
				limit = {
					government_has_flag = government_is_nomadic
				}
				if = { #Are they all vassals?
					limit = {
						any_in_list = {
							list = bride_show_preliminary_list
							is_vassal_of = scope:liege
							count >= 4
						}
						any_in_list = {
							list = bride_show_preliminary_list
							NOT = {
								is_vassal_of = scope:liege
							}
							count >= 1
						}
					}
					#Then tributaries are optional
					trigger_event = bride_show.1000
				}
				else = {
					if = {
						limit = {
							any_in_list = {
								list = bride_show_preliminary_list
								NOT = { is_vassal_of = scope:liege }
								count >= 1
							}
						}
						set_local_variable = {
							name = bride_show_tributary_participation
							value = yes
						}
					}
					trigger_event = {
						id = bride_show.0001
						days = { 7 10 }
					}
				}
			}
			else = { #Non-nomadic rulers
				if = { #Are they all vassals?
					limit = {
						any_in_list = {
							list = bride_show_preliminary_list
							is_vassal_of = scope:liege
							count >= 3
						}
						any_in_list = {
							list = bride_show_preliminary_list
							NOT = {
								is_vassal_of = scope:liege
							}
							count >= 1
						}
					}
					#Then tributaries are optional
					trigger_event = bride_show.1000
				}
				else = {
					if = {
						limit = {
							any_in_list = {
								list = bride_show_preliminary_list
								NOT = { is_vassal_of = scope:liege }
								count >= 1
							}
						}
						set_local_variable = {
							name = bride_show_tributary_participation
							value = yes
						}
					}
					trigger_event = {
						id = bride_show.0001
						days = { 7 10 }
					}
				}
			}
		}
	}
	
	ai_potential = { always = yes }

	ai_will_do = {
		base = 0
		ai_value_modifier = {
			ai_boldness = 0.2
		}
		ai_value_modifier = {
			ai_greed = 0.2
		}
		modifier = {
			add = 15
			has_trait = lustful
		}
		modifier = {
			add = -25
			has_trait = shy
		}
		modifier = {
			add = -10
			has_trait = craven
		}
		modifier = {
			add = -50
			has_trait = paranoid
		}
		modifier = {
			add = -20
			has_trait = chaste
		}
		modifier = {
			add = -40
			has_trait = eunuch
		}
		modifier = {
			add = -40
			has_trait = devoted
		}
		modifier = { #Sexuality
			add = -40
			has_trait = celibate
		}
		modifier = { #Sexuality
			add = -30
			has_sexuality = asexual
		}
		modifier = {
			add = 60
			hp_accepts_concubinage = yes
			number_of_concubines < number_of_desired_concubines
			NOT = {
				any_courtier = {
					can_become_concubine_of_character_valid_trigger = { CHARACTER = root }
					can_be_taken_as_muslim_concubine_trigger = {  # Can a Muslim be taken as concubine?
						CHARACTER = root 
						RECEIVER = root
					}
				}
			}
		}
		modifier = {
			hp_accepts_polygamy = yes
			trigger_if = {
				limit = {
					primary_title.tier >= 5
				}
				any_spouse = {
					count < 4
				}
			}
			trigger_else_if = {
				limit = {
					primary_title.tier >= 4
				}
				any_spouse = {
					count < 3
				}
			}
			trigger_else_if = {
				limit = {
					primary_title.tier >= 3
				}
				any_spouse = {
					count < 2
				}
			}
			trigger_else = {
				always = no
			}
			add = 30
		}
		modifier = {
			add = 15
			is_married = no
			is_betrothed = no
		}
		modifier = {
			add = 20
			hp_accepts_harems = yes
		}
	}
}

recruit_concubines_decision = {
	title = {
		first_valid = {
			triggered_desc = { # Can only recruit male concubines
				trigger = {
					is_male = no
					allowed_to_marry_same_sex_trigger = no
				}
				desc = recruit_male_concubines_decision_title
			}
			triggered_desc = { # Can only recruit female concubines
				trigger = {
					is_male = yes
					allowed_to_marry_same_sex_trigger = no
				}
				desc = recruit_female_concubines_decision_title
			}
			# Can have concubines of both sexes
			desc = recruit_concubines_decision_title
		}
	}
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_recruitment.dds"
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					is_female = no
				}
				desc = recruit_concubines_decision_desc_muslim_m
			}
			desc = recruit_concubines_decision_desc_muslim_f
		}
	}
	selection_tooltip = {
		first_valid = {
			triggered_desc = {
			    trigger = {
					is_female = yes
			    }
			    desc = recruit_concubines_selection_decision_tooltip_muslim_f
			}
			desc = recruit_concubines_selection_decision_tooltip_muslim_m
		}
	}

	decision_group_type = courtier
	ai_check_interval = 36
	sort_order = 120

	confirm_text = recruit_concubines_decision_confirm
	
	is_shown = {
		is_landed_or_landless_administrative = yes
		hp_accepts_concubinage = yes
		religion = religion:islam_religion
		OR = {
			any_neighboring_and_across_water_top_liege_realm_owner = {
				OR = {
					any_realm_province = {
						recruit_concubines_viable_county_trigger = {
							OVERLORD = root
						}
					}
					any_courtier_or_guest = {
						recruit_concubines_viable_candidate_trigger = {
							OVERLORD = root
						}
					}
					any_vassal_or_below = {
						any_courtier_or_guest = {
							recruit_concubines_viable_candidate_trigger = {
								OVERLORD = root
							}
						}
					}
					any_tributary = {
						OR = {
							any_courtier_or_guest = {
								recruit_concubines_viable_candidate_trigger = {
									OVERLORD = root
								}
							}
							any_realm_province = {
								recruit_concubines_viable_county_trigger = {
									OVERLORD = root
								}
							}
						}
					}
				}
			}
			any_realm_province = {
				recruit_concubines_viable_county_trigger = {
					OVERLORD = root
				}
			}
		}
		highest_held_title_tier >= tier_county
		OR = { #Appropriate dominant sex
			AND = {
				is_male = no
				OR = {
					has_realm_law = female_only_law
					has_realm_law = female_preference_law
				}
			}
			AND = {
				is_male = yes
				OR = {
					has_realm_law = male_only_law
					has_realm_law = male_preference_law
				}
			}
			has_realm_law = equal_law
		}
	}

	is_valid = {
		is_adult = yes
		is_at_war = no
		highest_held_title_tier >= tier_duchy
	}
	
	is_valid_showing_failures_only = {
		is_available = yes
		NOT = {
			has_trait = devoted
		}

		custom_tooltip = {
			text = contagious_disease_bride_show
			has_epidemic_disease_trigger = no
		}
		custom_tooltip = {
			text = epidemic_bride_show
			NOR = {
				realm_has_any_epidemic = {
					SIZE = 1
					INTENSITY = minor
				}
				capital_county = { has_county_modifier = isolate_capital_decision_modifier }
			}
		}
		custom_tooltip = {
			text = seclusion_bride_show
			NOR = {
				has_character_modifier = isolating_modifier
			}
		}
		custom_tooltip = {
			text = mourning_bride_show
			NOT = { has_character_modifier = mourner_modifier }
		}
	}
	
	
	cooldown = { years = 4 }
	
	cost = {
		gold = {
			value = medium_gold_value
			if = {
				limit = {
					highest_held_title_tier > tier_duchy
				}
				add = minor_gold_value
			}
		}
		prestige = minor_prestige_value
	}

	effect = {
		custom_tooltip = recruit_concubines_effect_tooltip
		hidden_effect = {
			save_scope_as = liege
			save_scope_as = actor
			# First check if there are available characters
			if = {
				limit = {
					any_realm_province = {
						recruit_concubines_viable_county_trigger = {
							OVERLORD = scope:liege
						}
					}
				}
				every_realm_province = {
					limit = {
						recruit_concubines_viable_county_trigger = {
							OVERLORD = scope:liege
						}
					}
					add_to_temporary_list = pool_provinces
				}
			}
			if = {
				limit = {
					any_neighboring_and_across_water_top_liege_realm_owner = {
						OR = {
							any_realm_province = {
								recruit_concubines_viable_county_trigger = {
									OVERLORD = scope:liege
								}
							}
							any_courtier_or_guest = {
								recruit_concubines_viable_candidate_trigger = {
									OVERLORD = scope:liege
								}
							}
							any_vassal_or_below = {
								any_courtier_or_guest = {
									recruit_concubines_viable_candidate_trigger = {
										OVERLORD = scope:liege
									}
								}
							}
							any_tributary = {
								OR = {
									any_courtier_or_guest = {
										recruit_concubines_viable_candidate_trigger = {
											OVERLORD = scope:liege
										}
									}
									any_realm_province = {
										recruit_concubines_viable_county_trigger = {
											OVERLORD = scope:liege
										}
									}
								}
							}
						}
					}
				}
				every_neighboring_and_across_water_top_liege_realm_owner = {
					# Province check
					if = {
						limit = {
							any_realm_province = {
								recruit_concubines_viable_county_trigger = {
									OVERLORD = scope:liege
								}
							}
						}
						every_realm_province = {
							limit = {
								recruit_concubines_viable_county_trigger = {
									OVERLORD = scope:liege
								}
							}
							add_to_temporary_list = pool_provinces
						}
					}
					# Courtier check
					if = {
						limit = {
							any_courtier_or_guest = {
								recruit_concubines_viable_candidate_trigger = {
									OVERLORD = scope:liege
								}
							}
						}
						every_courtier_or_guest = {
							limit = {
								recruit_concubines_viable_candidate_trigger = {
									OVERLORD = scope:liege
								}
							}
							add_to_list = pool_candidates
						}
					}
					# Vassal check
					if = {
						limit = {
							any_vassal_or_below = {
								any_courtier_or_guest = {
									recruit_concubines_viable_candidate_trigger = {
										OVERLORD = scope:liege
									}
								}
							}
						}
						every_vassal_or_below = {
							limit = {
								any_courtier_or_guest = {
									recruit_concubines_viable_candidate_trigger = {
										OVERLORD = scope:liege
									}
								}
							}
							every_courtier_or_guest = {
								limit = {
									recruit_concubines_viable_candidate_trigger = {
										OVERLORD = scope:liege
									}
								}
								add_to_list = pool_candidates
							}
						}
					}
					# Tributary check
					if = {
						limit = {
							any_tributary = {
								any_courtier_or_guest = {
									recruit_concubines_viable_candidate_trigger = {
										OVERLORD = scope:liege
									}
								}
							}
						}
						every_tributary = {
							limit = {
								any_courtier_or_guest = {
									recruit_concubines_viable_candidate_trigger = {
										OVERLORD = scope:liege
									}
								}
							}
							every_courtier_or_guest = {
								limit = {
									recruit_concubines_viable_candidate_trigger = {
										OVERLORD = scope:liege
									}
								}
								add_to_list = pool_candidates
							}
						}
					}
					if = {
						limit = {
							any_tributary = {
								any_realm_province = {
									recruit_concubines_viable_county_trigger = {
										OVERLORD = scope:liege
									}
								}
							}
						}
						every_tributary = {
							every_realm_province = {
								limit = {
									recruit_concubines_viable_county_trigger = {
										OVERLORD = scope:liege
									}
								}
								add_to_temporary_list = pool_provinces
							}
						}
					}
				}
			}
			if = {
				limit = {
					any_in_list = {
						list = pool_provinces
						any_pool_character = {
							province = this
							recruit_concubines_viable_candidate_trigger = {
								OVERLORD = scope:liege
							}
						}
						count > 0
					}
				}
				every_in_list = {
					list = pool_provinces
		
					every_pool_character = {
						province = this
						limit = {
							recruit_concubines_viable_candidate_trigger = {
								OVERLORD = scope:liege
							}
						}
						add_to_list = pool_candidates
					}
				}
			}
			if = {
				limit = {
					any_in_list = {
						list = pool_candidates
						count >= 3
					}
				}
				# Nothing
			}
			else = {
				hp_select_concubine_location_effect = yes
				while = {
					limit = {
						any_in_list = {
							list = pool_candidates
							count < 3
						}
					}
					calyver_create_candidate_effect = yes
				}
			}
			trigger_event = {
				id = bride_show.2000
				days = { 7 10 }
			}
		}
	}
	
	ai_potential = { always = yes }

	ai_will_do = {
		base = 0
		modifier = {
			add = 60
			number_of_concubines < number_of_desired_concubines
			NOT = {
				any_courtier = {
					can_become_concubine_of_character_valid_trigger = { CHARACTER = root }
					can_be_taken_as_muslim_concubine_trigger = {  # Can a Muslim be taken as concubine?
						CHARACTER = root 
						RECEIVER = root
					}
				}
			}
		}
		modifier = {
			add = 15
			has_trait = lustful
		}
		modifier = {
			add = -15
			has_trait = shy
		}
		modifier = {
			add = -10
			has_trait = craven
		}
		modifier = {
			add = -50
			has_trait = paranoid
		}
		modifier = {
			add = -15
			has_trait = chaste
		}
		modifier = { #Sexuality
			add = -20
			has_trait = celibate
		}
		modifier = { #Sexuality
			add = -20
			has_sexuality = asexual
		}
		modifier = {
			add = 10
			is_married = no
			is_betrothed = no
		}
	}
}